﻿Imports NMock2
 
Imports Microsoft.VisualStudio.TestTools.UnitTesting

Imports Meiners.Libs.Withings
Imports Meiners.Libs.Withings.Core



    '''<summary>
    '''This is a test class for MeasureGroupTest and is intended
    '''to contain all MeasureGroupTest Unit Tests
    '''</summary>
    <TestClass()> _
    Public Class MeasureGroupTest


        Private testContextInstance As TestContext

        '''<summary>
        '''Gets or sets the test context which provides
        '''information about and functionality for the current test run.
        '''</summary>
        Public Property TestContext() As TestContext
            Get
                Return testContextInstance
            End Get
            Set(ByVal value As TestContext)
                testContextInstance = value
            End Set
        End Property

        '''<summary>
        '''A test for MeasureGroupDate
        '''</summary>
        <TestMethod()> _
        Public Sub MeasureGroupDateTest()
            Dim target As MeasureGroup = New MeasureGroup
            Dim expected As DateTime = DateTime.Now
            Dim actual As DateTime
            target.MeasureGroupDate = expected
            actual = target.MeasureGroupDate
            Assert.AreEqual(expected, actual)
        End Sub

        '''<summary>
        '''A test for GroupId
        '''</summary>
        <TestMethod()> _
        Public Sub GroupIdTest()
            Dim target As MeasureGroup = New MeasureGroup
            Dim expected As Integer = 2568
            Dim actual As Integer
            target.GroupId = expected
            actual = target.GroupId
            Assert.AreEqual(expected, actual)
        End Sub

        '''<summary>
        '''A test for Category
        '''</summary>
        <TestMethod()> _
        Public Sub CategoryTest()
            Dim target As MeasureGroup = New MeasureGroup
            Dim expected As CategoryEnum = CategoryEnum.IsMeasure
            Dim actual As CategoryEnum
            target.Category = expected
            actual = target.Category
            Assert.AreEqual(expected, actual)
        End Sub

        '''<summary>
        '''A test for AttributionStatus
        '''</summary>
        <TestMethod()> _
        Public Sub AttributionStatusTest()
            Dim target As MeasureGroup = New MeasureGroup
            Dim expected As AttributionStatusEnum = AttributionStatusEnum.EnteredManually
            Dim actual As AttributionStatusEnum
            target.AttributionStatus = expected
            actual = target.AttributionStatus
            Assert.AreEqual(expected, actual)
        End Sub


        '''<summary>
        '''A test for AddMeasure
        '''</summary>
        <TestMethod()> _
        Public Sub AddMeasureTest()
            Dim target As MeasureGroup = New MeasureGroup ' TODO: Initialize to an appropriate value
            Dim item As Measure = New Measure(79300, -1, MeasureTypeEnum.Weight)
            Assert.AreEqual(Of Integer)(0, target.GetMeasures.Count, "Precondition for test missed")
            target.AddMeasure(item)
            Assert.AreEqual(Of Integer)(1, target.GetMeasures.Count, "Postcondition for test missed")
            Assert.AreEqual(Of Integer)(item.Unit, target.GetMeasures().First.Unit, "Unit not correct")
            Assert.AreEqual(Of MeasureTypeEnum)(item.MeasureType, target.GetMeasures().First.MeasureType, "MeasureType not correct")
            Assert.AreEqual(Of Double)(item.CalculateValue, target.GetMeasures().First.CalculateValue, "CalculateValue not correct")
        End Sub

        '''<summary>
        '''A test for MeasureGroup Constructor
        '''</summary>
        <TestMethod()> _
        Public Sub MeasureGroupConstructorTest()
            Dim target As MeasureGroup = New MeasureGroup
        End Sub
    End Class
